package com.gbei.center.oauth.mapper;

import com.gbei.center.model.OpenResource;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @Description: TODO
 */
@Component
public interface OpenResourceMapper extends Mapper<OpenResource> {

	/**
	 * 根据接口地址获取资源记录
	 * @param name
	 * @return
	 */
	@Select("select * from t_open_resource where `status` = 1 and `type` = 'api' and en_name = #{name}")
	OpenResource getOpenResourceByName(@Param("name") String name);

	/**
	 * 根据条件查询记录列表
	 * @param openAppId  应用ID
	 * @param parentId   父ID（api的资源ID）
	 * @param type 类型  action  field
	 * @return
	 */
	List<OpenResource> listOpenResource(@Param("openAppId") String openAppId,@Param("parentId") String parentId,@Param("type") String type);

	
}
